class Bomb {
  constructor(name) {
    this.name = name;
    this.timer = null;
  }

  start() {
    this.timer = setTimeout(() => {
      console.log(`${this.name} 爆炸了！`);
    }, 3000);
  }

  clear() {
    if (this.timer) {
      clearTimeout(this.timer);
      console.log(`${this.name} 被拆除了！`);
    }
  }
}

const b1 = new Bomb('炸弹1');
const b2 = new Bomb('炸弹2');

b1.start();
b2.start();

setTimeout(() => {
  b2.clear();
}, 1000);